<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>RxJS subject</title>
</head>
<body>
</body>
<script src="https://unpkg.com/@reactivex/rxjs@5.0.0-beta.12/dist/global/Rx.js"></script>
<script>
  const subject = new Rx.Subject();

  subject.subscribe({
    next(value) {
      console.log(value);
    },
    error(err) {
      console.error(err);
    },
    complete() {
      console.log('complete');
    }
  })

  subject.next('A new data');
  subject.complete();
</script>
</html>
